<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@taglib uri="/WEB-INF/el.tld" prefix="el"%>
<%@taglib uri="/WEB-INF/fn.tld" prefix="fn"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title></title>
		<c:import url="/includes/css_inc.jsp"/>
		<c:import url="/includes/js_inc.jsp"/>
		<script>
			$(function(){
				$("#saveProvice").button({
		            icons: {
		                primary: "ui-icon-power"
		            }
				}).click(function(){
					$("#listForm").submit();
				});
				$("#edit").button({
		            icons: {
		                primary: "ui-icon-disk"
		            }
				}).click(function(){
					$("#listForm").submit();
				});
			});
			function checkLength(object){
				var value = object.value;
				if (value != "" && value.length < 12) {
					alert("เลขบัญชีกระแสรายวันน้อยกว่า 12 หลักกรุณาตรวจสอบ");
					object.value = "";
					object.focus();
				}
			}
		</script>
	</head>
	<body>
		<c:set var="auth" value="${el:getMapValue(menuAuth, 'ACC60105')}"/>
		<c:import url="/apps/msg.jsp"/>
		<form class="acc67-form" name="listForm" id="listForm" action="${pageContext.request.contextPath}/acc6" method="post">
		<input type="hidden" name="app" id="app" value="ACC60105"/>
		<input type="hidden" name="job" id="job" value="${job}"/>
		<c:if test="${userInfo.roleId != '1'}" var="isDisable"/>
		<table width="100%" class="ui-widget ui-widget-content" border="0">
			<tr>
				<th align="left" class="acc67-header ui-widget-header" colspan="0"><b>${screenCode.ACC60105}</b></th>
			</tr>
<%-- 			<c:if test="${job == 'saveProvince'}">
				<tr>
					<td align="center"><button type="button" name="saveProvice" id="saveProvice" class="acc67-button">ดึงข้อมูลจังหวัด</button></td>
				</tr>
			</c:if> --%>
			<c:if test="${!empty provinceAccountBean}">
				<tr>
					<td>
						<fieldset>
							<legend> ข้อมูลบัญชีจังหวัด </legend>
								<table width="100%" class="acc67-grid ui-widget ui-widget-content" border="0">
									<tr>
										<th  align="center" class="ui-state-default" width="10%">รหัสจังหวัด</th>
										<th  align="center" class="ui-state-default">ชื่อจังหวัด</th>
										<th  align="center" class="ui-state-default" width="27%">ชื่อบัญชีจังหวัด</th>
										<th  align="center" class="ui-state-default" width="13%">เลขบัญชีออมทรัพย์</th>
										<th  align="center" class="ui-state-default" width="6%">เลขบัญชีกระแสรายวัน</th>
										<th  align="center" class="ui-state-default">ที่อยู่ สสจ.</th>
										<th  align="center" class="ui-state-default">กลุ่มงาน</th>
										<th  align="center" class="ui-state-default">โทร.</th>
										<th  align="center" class="ui-state-default">โทรสาร.</th>
									</tr>
									<c:forEach var="data" items="${provinceAccountBean}" varStatus="x">
										<input type="hidden" name="provinceId" id="provinceId" value="${data.provinceId}">
										<tr class="grid-tr-${x.count % 2}">
											<td align="center" valign="top">${data.provinceId}</td>
											<td align="left" valign="top">${data.provinceName}</td>
											<td valign="top">
												${data.provinceAccountName}
											</td>
											<td valign="top" align="center">
												${data.provinceAccountSaving}
											</td>
											<td align="center" valign="top">
												<input type="text" ${isDisable ? 'readonly' : '' } name="provinceAccountDaily" id="provinceAccountDaily" maxlength="13" onkeypress="return numberOnly(event)" onblur="checkLength(this);" value="${data.provinceAccountDaily}">
											</td>
											<td valign="top">
												<textarea cols="25" rows="2" name="provinceAccountAddress" id="provinceAccountAddress">${data.provinceAccountAddress}</textarea>
											</td>
											<td valign="top">
												<input type="text" name="groupWork" id="groupWork" value="${data.groupWork}"/>
											</td>
											<td valign="top">
												<input type="text" maxlength="15" name="telephoneNumber" id="telephoneNumber" value="${data.telephoneNumber}"/>
											</td>
											<td valign="top">
												<input type="text" maxlength="15" name="faxNumber" id="faxNumber" value="${data.faxNumber}"/>
											</td>
										</tr>
									</c:forEach>
									<tr>
										<td colspan="9" align="center">
											<c:if test="${fn:contains(auth, 'U')}">
												<button type="button" name="edit" id="edit" class="acc67-button"> บันทึกข้อมูล </button>
											</c:if>
										</td>
									</tr>
								</table>
						</fieldset>
					</td>
				</tr>
			</c:if>
			</table>
		</form>
	</body>
</html>